//
//  ViewController.m
//  10505
//
//  Created by student on 16/2/19.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *redText;
@property (weak, nonatomic) IBOutlet UITextField *greenText;
@property (weak, nonatomic) IBOutlet UITextField *blueText;
@property (weak, nonatomic) IBOutlet UIView *backView;
@property (weak, nonatomic) IBOutlet UISlider *slider1;
@property (weak, nonatomic) IBOutlet UISlider *slider2;
@property (weak, nonatomic) IBOutlet UISlider *slider3;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.backView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:255];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)slideCHange:(id)sender
{
    int value1 = self.slider1.value;
    self.redText.text = [NSString stringWithFormat:@"%i",value1];


    int value2 = self.slider2.value;
    self.greenText.text = [NSString stringWithFormat:@"%i",value2];


    int value3 = self.slider3.value;
    self.blueText.text = [NSString stringWithFormat:@"%i",value3];



    self.backView.backgroundColor = [UIColor colorWithRed:value1/255.0 green:value2/255.0 blue:value3/255.0 alpha:1
                                     ];
}

- (IBAction)backgroundTag:(id)sender {
    [self.view endEditing:YES];
}

@end
